<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>卖家-修改个人信息</title>
<link href="<?php echo $this->_webroot('/user/css/common.css'); ?>" rel="stylesheet" type="text/css" />
<link href="<?php echo $this->_webroot('/user/css/content1.css'); ?>" rel="stylesheet" type="text/css" />
<script src="<?php echo $this->_webroot('/user/js/jquery-1.7.1.min.js'); ?>" type="text/javascript"></script>
<script src="<?php echo $this->_webroot('/user/js/common.js'); ?>" type="text/javascript"></script>


 
</head>
<body>
<psp:tags     htmlname='user_topnav1'  iconname='usertopnav1' />
<psp:tags     htmlname='user_topsearch'  iconname='usertopsearch' />

<div class="main">
	<div class="main-left">
    	<div class="title">会员管理中心</div>
        <psp:tags     htmlname='user_menulist'  iconname='usermenulist' />
    </div>
<link href="<?php echo $this->_webroot('/user/css/shoprequest.css'); ?>" rel="stylesheet" type="text/css" />   
    <div class="main-right main_right">
	

            <div class="cont">
                <div class="title_uc"><h3>供货商基本信息</h3></div>               


			
      <form action="<?php echo $this->_url('supplier/info/');?>" method="post" name="form_profile"  enctype="multipart/form-data"  onsubmit="return checkform();">
       <table id="newAddress" width="100%" border="0" cellspacing="0">
					<tr>
						<th align="left" width="30%">&nbsp;&nbsp;供货商管理</th><th width="70%"><span></span></th>
					</tr>
					<tr><td class="textright">供货商名称：</td>
						<td align="left"><input type="text" name="data[supplierinfo][supi_name]" value="<?php echo  $user_info['supi_name'];?>" maxlength="12" /></td></tr>
					
					<tr><td class="textright"><span id="picspan"><?php if($user_info['supi_logo']){?><img src="<?php echo $user_info['supi_logo'];?>"  width="50px" height="50px" onerror="this.src='<?php echo $this->_webroot('/user/images/nopic.gif'); ?>'"/><?php  }else{?>供货商图标<?php }?></span></td><td align="left"><input type="file" name="attach[]" onchange="showimg(this)" />
					<br />
						图片应小于1M，jpg、png或gif格式。建议为300</>x300像素	
					</td></tr>
					
					<tr><td class="textright">负责人：</td>
					<td><input type="text" name="data[supplierinfo][supi_people]" value="<?php echo  $user_info['supi_people'];?>" maxlength="6" /></td></tr>
					<tr><td class="textright">电话号码：</td>
						<td><input type="text" name="data[supplierinfo][supi_telphone]" value="<?php echo  $user_info['supi_telphone'];?>" maxlength="20" /></td></tr>
					<tr><td class="textright">QQ：</td>
						<td><input type="text" name="data[supplierinfo][supi_qq]" value="<?php echo  $user_info['supi_qq'];?>" maxlength="20" /></td></tr>
					<tr>
						<td class="textright">所在地区:</td>
						<td style="float:none;">
								<span id="user_country">
								<select name="data[supplierinfo][supi_country]" onchange="areachanged(this.value,0);">
									<option value='0'>选择国家</option>
								 <?php   foreach($areas_info[0] as $v){?>
									<option value="<?php echo  $v['id'];?>" <?php  if($v['id']==$user_info['supi_country']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php }?>
								</select>
								</span>
								
								<span id="user_province"><?php  if($user_info['supi_country']){?>
								<select name="data[supplierinfo][supi_province]" onchange="areachanged(this.value,1);">
									<option value='0'>选择省份</option>
								<?php foreach($areas_info[1] as $v) {
										if($v['parent_id'] == $user_info['supi_country']){?>
									<option value="<?php echo  $v['id'];?>" <?php   if($v['id']==$user_info['supi_province']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?>
								</select>
								<?php }?>
								</span>
								
								<span id="user_city">
								<?php 	 if($user_info['supi_province']){?>
								<select name="data[supplierinfo][supi_city]" onchange="areachanged(this.value,2);">
									<option value='0'>选择城市</option>
								    <?php foreach($areas_info[2] as $v) {
										if($v['parent_id'] == $user_info['supi_province']){?>
									<option value="<?php echo  $v['id'];?>" <?php  if($v['id']==$user_info['supi_city']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?></select>
								<?php }?>
								</span>
								
								<span id="user_district">
								<?php  if($user_info['supi_city']) {?>
								<select name="data[supplierinfo][supi_district ]">
									<option value='0'>选择地区</option>
								<?php foreach($areas_info[3] as $v) {
										if($v['parent_id'] == $user_info['supi_city']){?>
									<option value="<?php echo  $v['id'];?>" <?php   if($v['id']==$user_info['supi_district']){echo 'selected';}?>><?php echo  $v['area_name'];?></option>
								<?php 	}
								}?>
								</select>
								<?php }?>
								</span>
						<span class="red">*</span></td>
					</tr>
					
					<tr><td class="textright">供货商地址：</td>
						<td><input type="text" name="data[supplierinfo][supi_address]" value="<?php echo  $user_info['supi_address'];?>" maxlength="20" /></td></tr>						
					<tr><td class="textright" width="15%">供货商分类:</td>
						<td style="float:none;">
						
							<span id="shop_country">
								<select name="data[supplierinfo][supi_categories_parent]" onchange="categorieschanged(this.value)">
									<option value='0'>选择分类</option>
									<?php  foreach($shop_categories_parent as $v) {?>
										<option value="<?php echo  $v['shopcategories']['id'];?>"
											<?php  if($v['shopcategories']['id']==$categories_parent){echo 'selected';}?>><?php echo  $v['shopcategories']['cat_name'];?></option>
									<?php }?>
								</select>
							</span>
							<span id="shop_categories">
	
							</span>						
						<span class="red">*</span>
						</td>
					</tr>					
					<tr style="line-height:18px;"><td class="textright">供货商简介:</td>
						<td>
						<textarea name="data[supplierinfo][supi_content]" id="shopintro" cols="60" rows="10"><?php echo  $user_info['supi_content'];?></textarea>
					</td></tr>						
					<tr><td></td><td><span><input type="submit" name="submit" value="提交订单" /></span></td></tr>
				</table>

		</form>			  		  
            </div>
    </div>
    <div class="clear"></div>
</div>

<div class="footer">
    <psp:tags     htmlname='user_footer_helper'  iconname='userfooterhelper' />

</div>
<script language="JavaScript" src="<?php echo $this->_webroot('servtools/ajax_client/ajax.js');?>"></script>
<script language="JavaScript">
<!--
categorieschanged(<?php echo $categories_parent ?>,<?php echo $categories_child ?>);

function areachanged(value,type){
	if(value > 0) {	
		ajax("<?php echo $this->_url('user/getareas');?>","POST","value="+value+"&mode=supplierinfo&pre=supi_&type="+type,function(return_text){
			var return_text = return_text.replace(/[\n\r]/g,"");
			if(return_text==""){
				alert("请重新选择!！");
			} else {
				if(type==0) {
					document.getElementById("user_province").innerHTML = return_text;
					show("user_province");
					hide("user_city");
					hide("user_district");
				} else if(type==1) {
					document.getElementById("user_city").innerHTML = return_text;
					show("user_city");
					hide("user_district");
				} else if(type==2) {
					document.getElementById("user_district").innerHTML = return_text;
					show("user_district");
				}
			}
		});
	} else {
		if(type==2) {
			hide("user_district");
		} else if(type==1) {
			hide("user_district");
			hide("user_city");
		} else if(type==0) {
			hide("user_district");
			hide("user_city");
			hide("user_province");
		}
	}
}
function categorieschanged(value,child_value){
	if(value > 0) {
		ajax("<?php echo $this->_url('user/getshopcategories');?>","POST","mode=supplierinfo&value="+value+"&child_value="+child_value,function(return_text){
			return_text = return_text.replace(/[\n\r]/g,"");
			document.getElementById("shop_categories").innerHTML = return_text;
			show("shop_categories");
		});
	}
}

function showimg(obj) {
	var picspan = document.getElementById("picspan");
	picspan.innerHTML = '';
	var Img = new Image();
	Img.id = "goods_pic";

		if(navigator.userAgent.indexOf("MSIE")>0) {
			Img.src = obj.value;
		} else {
			Img.src = obj['files'][0].getAsDataURL();
		}

	picspan.appendChild(Img);
	//imgwh();
	setTimeout("imgwh()",100);
}

function hide(id) {
	document.getElementById(id).style.display = 'none';
}
function show(id) {
	document.getElementById(id).style.display = '';
}

function checkForm() {
/*	var shop_name = document.getElementsByName("shop_name")[0];
	var shop_address = document.getElementsByName("shop_address")[0];
	var shop_management = document.getElementsByName("shop_management")[0];
	if(shop_name.value=='') {
		alert("供货商名称不能为空！");
		shop_name.focus();
		return false;
	}else if(document.getElementsByName("country")[0].value==0) {
		alert("请选择国家！");
		return false;
	} else if(document.getElementsByName("province")[0].value==0) {
		alert("请选择省份！");
		return false;
	} else if(document.getElementsByName("city")[0].value==0) {
		alert("请选择城市！");
		return false;
	} else if(document.getElementsByName("district")[0].value==0) {
		alert("请选择地区！");
		return false;
	} else if(shop_address.value=='') {
		alert("供货商账户不能为空！");
		shop_name.focus();
		return false;
	} else if(shop_management.value=='') {
		alert("电话号码不能为空！");
		shop_management.focus();
		return false;
	}*/
	return true;
}

//-->
</script>

</body>
</html>